package com.itheima.Practice;

import java.util.Scanner;

public class Menu {
    private Method method = new Method();
    private Scanner scanner = new Scanner(System.in);

    public void showMenu() {
        while (true) {
            System.out.println("-----欢迎使用学生管理系统-----");
            System.out.println("1.添加学生");
            System.out.println("2.删除学生");
            System.out.println("3.修改学生");
            System.out.println("4.查询学生");
            System.out.println("5.退出系统");
            System.out.print("请输入您的选择：");
            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    method.addStudent();
                    break;
                case 2:
                    method.deleteStudent();
                    break;
                case 3:
                    method.updateStudent();
                    break;
                case 4:
                    method.queryStudent();
                    break;
                case 5:
                    System.out.println("感谢您的使用，再见！");
                    System.exit(0);
                default:
                    System.out.println("输入有误，请重新输入");
            }
        }
    }
}
